﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:MiniUML.View.Controls">
    
    <Style TargetType="{x:Type controls:RibbonGroup}">

        <Style.Resources>

            <!-- HeaderTemplate -->
            <DataTemplate x:Key="HeaderTemplate">

                <TextBlock Margin="5,0,5,1"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Foreground="{DynamicResource Style.Brushes.RibbonGroup.HeaderForeground}"
                               Text="{Binding}"/>

            </DataTemplate>

            <!-- ControlTemplate -->
            <ControlTemplate x:Key="ControlTemplate" TargetType="{x:Type controls:RibbonGroup}">

                <Grid>

                    <!-- Border highlight (outside) -->
                    <Border SnapsToDevicePixels="True"
                                CornerRadius="0,4,4,4"
                                BorderThickness="0,0,1,1"
                                BorderBrush="{DynamicResource Style.Brushes.RibbonGroup.BorderHighlight}"/>

                    <!-- Border -->
                    <Border Margin="0,0,1,1"
                                SnapsToDevicePixels="True"
                                CornerRadius="3"
                                BorderThickness="1"
                                BorderBrush="{DynamicResource Style.Brushes.RibbonGroup.Border}"
                                Background="Transparent">

                        <Grid>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <!-- Content Background -->
                            <Border Grid.Row="0"
                                        SnapsToDevicePixels="True"
                                        CornerRadius="2,2,0,0"
                                        BorderThickness="0"
                                        Background="{DynamicResource Style.Brushes.RibbonGroup.Background}">

                                <!-- Border highlight (inside) -->
                                <Border SnapsToDevicePixels="True"
                                            CornerRadius="2,2,0,0"
                                            BorderThickness="1,1,0,0"
                                            BorderBrush="{DynamicResource Style.Brushes.RibbonGroup.BorderHighlight}">

                                    <!-- Content -->
                                    <ContentPresenter Margin="3,3,3,4" ContentSource="Content"/>

                                </Border>

                            </Border>

                            <!-- Header Background -->
                            <Border Grid.Row="1"
                                        SnapsToDevicePixels="True"
                                        Margin="0,0,0,0"
                                        CornerRadius="0,0,2,2"
                                        BorderThickness="0"
                                        Background="{DynamicResource Style.Brushes.RibbonGroup.HeaderBackground}">

                                <!-- Header -->
                                <ContentPresenter Margin="0,1,0,1" ContentSource="Header"/>

                            </Border>

                        </Grid>

                    </Border>

                </Grid>

            </ControlTemplate>

        </Style.Resources>

        <Setter Property="Margin" Value="0,0,3,0"/>
        <Setter Property="Template" Value="{StaticResource ControlTemplate}"/>
        <Setter Property="HeaderTemplate" Value="{StaticResource HeaderTemplate}"/>

    </Style>

</ResourceDictionary>